package org.southyin.service.impl;

import org.southyin.dao.StuDao;
import org.southyin.dao.StuDaoImpl;
import org.southyin.model.Stu;
import org.southyin.service.StuService;
import org.southyin.utils.DBUtils;

import java.sql.SQLException;
import java.util.List;

public class StuServiceImpl implements StuService {
    StuDao dao = new StuDaoImpl();
    @Override
    public List<Stu> getStuInfos() {
        List<Stu> stuInfos = null;
        try {
            DBUtils.conn = DBUtils.getInstance().getConnection();
            stuInfos = dao.getStuInfos();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            DBUtils.getInstance().close(DBUtils.conn);
        }
        return stuInfos;
    }
}
